<!--
 * @Author: HeAo
 * @Date: 2021-10-15 10:21:47
 * @LastEditTime: 2021-10-15 11:31:43
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \web2103-2105\web2105\3-2-Vue\day07\6-axios-默认配置.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>axios基础使用</title>
  <script src="../js/axios.js"></script>
  <script src="../js/qs.js"></script>
  <script>
    let qs = Qs
    const loginData = {
      username: 'admin1',
      password: 123321
    }
    const applyData = {
      name: 'larry',
      gender: 'female',
      telephone: '13455667788'
    }

    // 1.默认配置
    axios.defaults.baseURL = 'http://47.94.46.113:8888'
    axios.defaults.headers.common['Authorization'] = 'afadfhsiudfhsnf'
    axios.defaults.headers.post['Auth'] = 'zhangsan'

    axios.get(
      '/index/article/pageQuery',
      {
        params: {
          page: 1,
          pageSize: 10
        }
      }
    ).then(res => {
      console.log(res.data.data.list);
    })

    axios.post(
      '/user/login',
      loginData
    ).then(res => {
      console.log(res.data.data.token);
    })
  </script>
</head>

<body>

</body>

</html>